import sys
import os
from prettytable import PrettyTable

addonf = []
manager = sys.argv
if len(manager) > 1:
    if manager[1] == "version":
        print("GSAddon Manager 0.5\n兼容版本:GSAddon 0.5")
    elif manager[1] == "list":
        try:
            with open('GSAddon.ini', 'r', encoding='utf-8') as file:
                table = PrettyTable(['插件名','方法名', '插件路径', '版本','类型'])
                addon = file.readlines()
                for q in addon:
                    table.add_row([q.split(" ")[3],q.split(" ")[0], q.split(" ")[1], q.split(" ")[2],q.split(" ")[4]])
                print(table)
                # print("已添加插件:"+str(addonf))
                file.close()
        except FileNotFoundError:
            print('无法读取GSAddon.ini')
else:
    print("GSAddon Manager\n可用:\n   list 查看已安装插件\n   version 查看GSAddon Manager关于")